<template>
    <view class="u-p-t-28 main-pd">
        <view class="u-card u-m-b-20 u-flex-grow" v-for="item in xqArr" :key="item.id">
              <view class="font-32 color-333">
                <view class="list-item">
                  <view class="u-flex u-flex-between">
                    <view>所属小区</view>
                    <view>{{ item.deptName || '' }}</view>
                  </view>
                </view>
                <view class="list-item">
                  <view class="u-flex u-flex-between">
                    <view>单元位置</view>
                    <view>{{ item.louNumber || '' }}楼{{ item.dyNumber || '' }}单元{{ item.fjNumber || '' }}号</view>
                  </view>
                </view>
                <view class="list-item">
                  <view class="u-flex u-flex-between">
                    <view>姓名</view>
                    <view>{{ item.name || '' }}</view>
                  </view>
                </view>
                <view class="list-item">
                  <view class="u-flex u-flex-between">
                    <view>性别</view>
                    <view>{{ sexParam(item.sex) }}</view>
                  </view>
                </view>
                <view class="list-item">
                  <view class="u-flex u-flex-between">
                    <view>联系方式</view>
                    <view>{{ item.tel || '' }}</view>
                  </view>
                </view>
              </view>
            </view>
    </view>
</template>
<script setup>
import { ref, reactive, computed } from "vue"
import { getFcInfoApi } from "@/api/index"
import { onLoad, onShow } from "@dcloudio/uni-app"
let xqArr = ref([])
let searchInfo = ref('')
let cardType = ref('')
const getInfo = () => {
    getFcInfoApi({
        zkfk: cardType.value,
        searchInfo: searchInfo.value
    }).then(res => {
        if (res.success) {
            xqArr.value = res.data
        }
    })
}
const sexParam = computed((sex) => {
    return function (sex) {
        console.log('sex: ', sex);
        let flag = Number.isNaN(+sex)
        console.log('flag: ', flag);
        if (flag) {
            return sex
        } else {
            return sex == 0 ? '女' : '男'
        }
    }
})
onLoad((param) => {
    if (param.isZk == 1) {
        cardType.value = 1
        searchInfo.value = param.idcard
    } else {
        cardType.value = 0
        searchInfo.value = param.dzkTel
    }
    getInfo()
})
</script>
<style lang="scss" scoped></style>